
import * as echarts from 'echarts';
export const handlerData = ({ dateList, barData, lineData }) => {
    console.log('data', data);
    // const dateList = dateList
    return {
        tooltip: {
            trigger: 'item',
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '2%',
            right: '4%',
            bottom: '2%',
            top: '16%',
            containLabel: true
        },
        xAxis: {
            type: 'category',
            data: dateList,
            axisLine: {
                lineStyle: {
                    color: '#cdd5e2'

                }
            },
            axisLabel: {
                textStyle: {
                    color: "#666666"
                }
            },
        },

        yAxis: [{
            type: 'value',
            axisLine: {
                show: false,
                lineStyle: {
                    color: '#cdd5e2'
                }
            },
            splitLine: {
                show: false,
            },
            axisLabel: {
                textStyle: {
                    color: "#666666"
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#cdd5e2'
                }
            },
            splitLine: {
                lineStyle: {
                    color: 'rgba(131,101,101,0.2)',
                    type: 'dashed',
                }
            }
        },
        {
            type: "value",
            name: "",
            nameTextStyle: {
                color: "#666666"
            },
            position: "right",
            axisLine: {
                lineStyle: {
                    color: '#cdd5e2'
                }
            },
            splitLine: {
                show: false,
            },
            axisLabel: {
                show: true,
                formatter: "{value} %", //右侧Y轴文字显示
                textStyle: {
                    color: "#666666"
                }
            }
        }
        ],
        // dataZoom: [
        //     {
        //         type: 'slider',
        //         realtime: true,
        //         show: dateList.length > 6,
        //         brushSelect: false,
        //         start: 0,
        //         end: dateList.length > 7 ? (7 / dateList.length) * 100 : 100,
        //         xAxisIndex: [0, 1],
        //         bottom: 0,
        //         height: 20,
        //         zoomLock: true,
        //     },
        //     {
        //         type: 'inside',
        //         show: dateList.length > 6,
        //         realtime: true,
        //         // startValue: 0,
        //         // endValue: 6,
        //         xAxisIndex: [0, 1],
        //         zoomLock: true,
        //     }],
        series: [{
            // name: '调解成功',
            type: 'bar',
            barWidth: '24px',
            itemStyle: {
                normal: {
                    color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
                        offset: 0,
                        color: '#29acff'
                    }, {
                        offset: 1,
                        color: '#4bdfff'
                    }]),
                },
            },
            data: barData
        },
        {
            name: "调解成功率",
            type: "line",
            yAxisIndex: 1, //使用的 y 轴的 index，在单个图表实例中存在多个 y轴的时候有用
            smooth: false, //平滑曲线显示

            symbol: "circle", //标记的图形为实心圆
            symbolSize: 8, //标记的大小
            itemStyle: {
                normal: {
                    color: '#ffa43a',
                    borderColor: 'rgba(255, 234, 0, 0.5)',  //圆点透明 边框
                    borderWidth: 5
                },

            },
            lineStyle: {
                color: "#ffa43a"
            },

            data: lineData
        }
        ]
    };

}



